﻿using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using YOUYOU.Core;

namespace 抖音弹幕
{
    public partial class GiftConfig : Form
    {
      
        public GiftConfig()
        {

            InitializeComponent();

        }

        private void buttontj_Click(object sender, EventArgs e)
        {
            // 添加新行
            BarrageGrab.Entity.Models.GiftConfig gift = new BarrageGrab.Entity.Models.GiftConfig();
             gift.Id = textBox1.Text;
            gift.Num = textBox2.Text.ToString();
            gift.Gift = comboBox1.Text.ToString();
            gift.JsFunction= comboBox2.Text.ToString();
            gift.Path = textBox3.Text;
            bool isok = SqlsugarHelper.db.Insertable(gift).ExecuteCommandIdentityIntoEntity();
            if (isok)
                MessageBox.Show("保存成功");
            else
                MessageBox.Show("保存失败");
        }

        private void buttosc_Click(object sender, EventArgs e)
        {
            bool isok = SqlsugarHelper.db.Deleteable<BarrageGrab.Entity.Models.GiftConfig>(t=>t.Id== textBox1.Text).ExecuteCommandHasChange();
            if (isok)
                MessageBox.Show("删除成功");
            else
                MessageBox.Show("删除失败");
        }
    }
}
